import Vue from 'vue'
import App from './App.vue'
import Vuex from "vuex";

//安装Vuex后use
Vue.use(Vuex)
let store = new Vuex.Store({
     state:{
       num:999
     },
     actions:{
         handlencAdd:function(state){
            setTimeout(function(){
               state.commit("add")
            },2000) 
         }
     },
     mutations:{
       add:function(state){
          state.num++
       },
       sub:function(state){
          state.num--
       },
     }
})

Vue.config.productionTip = false

new Vue({
  store,
  render: h => h(App),
}).$mount('#app')
